package cn.bugstack.test.domain.strategy;

import cn.bugstack.domain.strategy.service.armory.IStrategyArmory;
import cn.bugstack.domain.strategy.service.armory.IStrategyDispatch;
import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class StrategyArmoryDispatchTest {

    @Resource
    private IStrategyArmory strategyArmory;
    @Resource
    private IStrategyDispatch strategyDispatch;
    @Before
    public void test_strategyArmory(){
        boolean success = strategyArmory.assembleLotteryStrategy(10001L);
        log.info("测试结果：{}",success);
    }
    @Test
    public void test_getAssembleRandomId(){
        log.info("测试结果{} - 奖品ID值", strategyDispatch.getRandomAwardId(10001L));
    }


    @Test
    public void test_getAssembleRandomId_ruleWeightValue(){

        log.info("测试结果{} - 4000 策略配置", strategyDispatch.getRandomAwardId(10001L,"4000"));
        log.info("测试结果{} - 5000 策略配置", strategyDispatch.getRandomAwardId(10001L,"5000"));
        log.info("测试结果{} - 6000 策略配置", strategyDispatch.getRandomAwardId(10001L,"6000"));
    }

}
